﻿
/*********************物流项目三组************************
*  功能描述：货主合同管理
*  作者：郭辉
*  时间：2022-01-10
*  修改人：郭辉
*  修改时间：2022-01-10
*********************物流项目三组************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TodoApp.ResultModel;
using Volo.Abp.Application.Services;

namespace TodoApp.TMS_Contract.Contracts
{
    public class TMS_ContractAppService:ApplicationService
    {
        private readonly ITMS_ContractAppRepository _tMS_ContractAppRepository;
        public TMS_ContractAppService(ITMS_ContractAppRepository tMS_ContractAppRepository)
        {
            _tMS_ContractAppRepository= tMS_ContractAppRepository;
        }

        #region 货主合同添加
        public async Task<int> CreateContracts(TMS_ContractsDto info)
        {
            return await _tMS_ContractAppRepository.CreateContracts(info);
        }
        #endregion

        #region 货主合同显示分页查询
        public async Task<PageResponse<TMS_ContractsDto>> GetAllContracts(string ContractsTitle, string ContractUnits, string ContractName, string ContractAttentionLine, DateTime? ContractCreateDate, int ContractState, int pageindex = 1, int pagesize = 5)
        {
            return await _tMS_ContractAppRepository.GetAllContracts(ContractsTitle, ContractUnits, ContractName, ContractAttentionLine, ContractCreateDate, ContractState, pageindex, pagesize);
        }
        #endregion

        #region 货主合同删除
        public async Task<int> DeleteContracts(string id)
        {

            return await _tMS_ContractAppRepository.DeleteContracts(id);

            //var dbConnection = await GetDbConnectionAsync();
            //return await dbConnection.ExecuteAsync("update TMS_Contracts set Contract_Title=@NewName", new { NameName = name }, await GetDbTransactionAsync());
        }
        #endregion

        #region 货主合同批量删除
        public async Task<int> DeleteSContracts(string ids)
        {

            return await _tMS_ContractAppRepository.DeleteSContracts(ids);

            //var dbConnection = await GetDbConnectionAsync();
            //return await dbConnection.ExecuteAsync("update TMS_Contracts set Contract_Title=@NewName", new { NameName = name }, await GetDbTransactionAsync());
        }
        #endregion


        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public async Task<int> UpdatePersonNames(TMS_ContractsDto info)
        {
            return await _tMS_ContractAppRepository.UpdatePersonNames(info);
        }

        #region 承运合同显示分页查询
        public async Task<PageResponse<TMS_ContractsDto>> GetAllCarriageContracts(string ContractsTitle, string ContractUnits, string ContractName, string ContractAttentionLine, DateTime? ContractCreateDate, int ContractState, int pageindex = 1, int pagesize = 5)
        {
            return await _tMS_ContractAppRepository.GetAllCarriageContracts(ContractsTitle, ContractUnits, ContractName, ContractAttentionLine, ContractCreateDate, ContractState, pageindex, pagesize);
        }
        #endregion

        #region 通用合同显示分页查询
        public async Task<PageResponse<TMS_ContractsDto>> GetAllContContracts(string ContractsTitle, string ContractUnits, string ContractName, string ContractAttentionLine, DateTime? ContractCreateDate, int ContractState, int pageindex = 1, int pagesize = 5)
        {
            return await _tMS_ContractAppRepository.GetAllContContracts(ContractsTitle, ContractUnits, ContractName, ContractAttentionLine, ContractCreateDate, ContractState,pageindex, pagesize);
        }
        #endregion
    }
}
